package com.hundsun.cprs.yyt.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 业务码枚举
 * 
 * @author linbo
 *
 */
public enum EnumBusinessCode {
	//1000-1099 通用的业务提示
	BUSINESS_1000(1000, "参数错误"),
	/** 用户不存在 */
	BUSINESS_1001(1001, "用户不存在"),
	/** 用户状态不正确 */
	BUSINESS_1002(1002, "用户状态不正确"),
	/** 资金账户不存在 */
	BUSINESS_1003(1003, "资金账户不存在"),
	/** 资金状态不正确 */
	BUSINESS_1004(1004, "资金状态不正确"),
	/**请稍后再试*/
	BUSINESS_1005(1005, "正在处理中，请稍后再试"),
	/**数据记录不存在*/
	BUSINESS_1006(1006, "记录不存在"),
	/**短信发送失败*/
	BUSINESS_1007(1007, "短信发送失败"),
	/**会员注册失败*/
	BUSINESS_1008(1008,"会员注册失败"),
	/**编辑会员信息失败*/
	BUSINESS_1009(1009,"编辑会员信息失败"),
	/**实名认证失败*/
	BUSINESS_1010(1010,"实名认证失败"),
	/**请稍后再试*/
	BUSINESS_1011(1011, "请勿重复操作"),
	/**请稍后再试*/
	BUSINESS_1012(1012, "出手太慢，请重新出价"),
	/**注册账号已存在*/
	BUSINESS_1013(1013, "注册账号已存在"),
	/**经纪人不存在*/
	BUSINESS_1014(1014, "经纪人不存在"),
	/**密码修改失败*/
	BUSINESS_1015(1015, "密码修改失败"),
	/**验证码校验失败*/
	BUSINESS_1016(1016, "验证码校验失败"),
	/**头像上传失败*/
    BUSINESS_1017(1017, "会员头像上传失败"),
    /**账号绑定失败*/
    BUSINESS_1018(1018, "图片上传失败"),
	/**图像上传失败*/
	BUSINESS_1019(1019, "三方账号绑定会员账号出错"),
	BUSINESS_1020(1020, "用户类型不正确"),
	/**模式配置错误*/
    BUSINESS_1021(1021, "竞购模式配置错误"),
    /**推荐人账号为必填**/
    BUSINESS_1022(1022, "推荐人账号不能为空"),
    /**系统参数配置不存在**/
    BUSINESS_1023(1023, "系统参数配置不存在"),
	/**推荐人交易账号不存在**/
	BUSINESS_1024(1024, "推荐人交易账号不存在"),
	/**发布规则加载错误**/
	BUSINESS_1025(1025, "发布规则加载错误"),
	/**sku属性更新失败**/
	BUSINESS_1026(1026, "sku属性更新失败"),
	/**推荐人推荐人数到达上线**/
	BUSINESS_1029(1029, "推荐人推荐人数到达上线"),

	/**您的当日配额消费已达上限**/
	BUSINESS_1027(1027, "您的当日配额消费已达上限"),
	BUSINESS_1028(1028, "支付密码不正确"),

	//1030-1039 状态相关错误码
	BUSINESS_1031(1031, "用户审核未通过，请前往重新提交实名审核"),
	BUSINESS_1032(1032, "用户待审核，请耐心等待审核结果"),
	BUSINESS_1033(1033, "用户未实名，请前往实名认证"),

	BUSINESS_1034(1034, "下一清算日不存在，报送清算中心失败"),
	BUSINESS_1035(1035, "当前时间不是清算日，不允许进行开闭市操作"),
	BUSINESS_1036(1036, "日终清算期间不允许交易"),
	BUSINESS_1037(1037,"{0}天内限制连续委卖商品,请等待限制周期结束后购买"),
	BUSINESS_1038(1038,"超出委卖商品数限制"),
	BUSINESS_1039(1039,"下单失败，商品为金莱花产品，仅允许金莱花号段会员购买"),
	BUSINESS_1040(1040,"下单失败，您是金莱花号段会员，不允许购买非金莱花产品"),
	BUSINESS_1041(1041,"下单失败，该商品为限购商品，您的剩余可购买量为：{0}"),
	BUSINESS_1042(1042,"下单失败，该商品为每日限购商品，您当日剩余可购买量为：{0}"),

	//1100-1200 竞购交易
	/** 余额不足 */
	BUSINESS_1101(1101, "可用余额不足"),
	/** 商品不存在 */
	BUSINESS_1102(1102, "商品不存在"),
	/** 商品不在竞购中 */
	BUSINESS_1103(1103, "商品不在竞购中"),
	/** 出价失败-涨幅不符合规定 */
	BUSINESS_1104(1104, "出手太慢，请重新出价"),
	/** 商品没有最新价 */
	BUSINESS_1105(1105, "商品没有最新价"),
	/** 商品没有保证金记录 */
	BUSINESS_1106(1106, "商品没有保证金记录"),
	/** 商品状态不正确 */
	BUSINESS_1107(1107, "商品状态不正确"),
	/**保证金已缴纳，请等待竞购.*/
	BUSINESS_1108(1108, "保证金已缴纳，请等待竞购."),
	/**商品未在预购或竞购中.*/
	BUSINESS_1109(1109, "商品未在预购或竞购中."),
	/**不能连续出价N次.*/
	BUSINESS_1110(1110, "不能连续出价超过{0}次"),
	/**不能连续出价.*/
	BUSINESS_1111(1111, "不能连续出价"),
	BUSINESS_1112(1112, "{0}不允许出价"),
	
	BUSINESS_1113(1113, "智能出价规则不满足,限制分钟为{0}"),
	BUSINESS_1114(1114, "专场出价限次更新失败"),
	BUSINESS_1115(1115, "专场出价规则记录已存在"),
	BUSINESS_1116(1116, "专场出价规则数据错误"),
	
	BUSINESS_1120(1120, "交易准入金不满足：{0}"),
	BUSINESS_1121(1121, "VIP等级受限，不允许出价."),
	BUSINESS_1122(1122, "交易对手方信息不存在."),
	BUSINESS_1123(1123, "交易时间段为：{0}，当前时间不允许交易"),
	BUSINESS_1124(1124, "当前为新人专场，老用户不允许下单"),



	//1500-1599 订单
	/** 订单记录不存在 */
	BUSINESS_1501(1501, "订单记录不存在"),
	BUSINESS_1502(1502, "订单记录状态不正确"),
	BUSINESS_1503(1503, "成交价格与保证金数据差值异常"),
	BUSINESS_1504(1504, "确认人与订单成交人不一致"),
	BUSINESS_1505(1505, "订单记录已经存在"),
	BUSINESS_1509(1509, "非批发区商品不支持挂售"),
	BUSINESS_1510(1510, "库存不足"),
	BUSINESS_1511(1511, "该商品已上架，不允许删除"),
	BUSINESS_1512(1512, "挂售单不存在"),
	BUSINESS_1513(1513, "申请人和挂售单用户不一致"),
	BUSINESS_1514(1514, "挂售单不处于待上报状态"),
	BUSINESS_1515(1515, "挂售单当前状态，不允许申请发货"),
	BUSINESS_1516(1516, "挂售单当前状态，不允许申请退货"),
	BUSINESS_1517(1517, "您的每日挂单数量超过限制"),
	BUSINESS_1518(1518, "您的每日挂单金额总数超过限制"),
	BUSINESS_1519(1519, "您的两次挂单时间间隔不符合平台限制"),
	BUSINESS_1520(1520, "委托单不存在"),
	BUSINESS_1521(1521, "订单还未匹配成功，不允许发货"),
	BUSINESS_1522(1522, "查询用户与订单成交人不一致"),
	BUSINESS_1523(1523, "订单状态不处于待发货，不允许发货"),
	BUSINESS_1524(1524, "物流公司不存在"),
	BUSINESS_1525(1525, "挂售单关联的订单不存在，不允许发货，请联系平台处理"),




	//1200-1299 专场
	BUSINESS_1201(1201, "专场不存在"),
	BUSINESS_1202(1202, "新人专场不存在"),
	//1300-1399 商品
	BUSINESS_1300(1300, "商品编码已存在"),
	BUSINESS_1301(1301, "商品未关联图片"),
	BUSINESS_1302(1302, "该场竞购已开启禁言"),
	BUSINESS_1303(1303, "您已关注该商品"),
	BUSINESS_1304(1304, "您已取消关注该商品"),
	BUSINESS_1305(1305, "批发区商品规格不能为空"),

	//1400-1499 账户模块
	BUSINESS_1400(1400, "交易账户不存在"),
	BUSINESS_1401(1401, "配额不足"),
	BUSINESS_1402(1402, "配额无效"),
	//1600-1699 分类
	BUSINESS_1601(1601, "分类不存在"),
	
	CLASSIFY_1600(1600,"请求参数错误"),
	CLASSIFY_1601(1601,"类目编码为空"),
	CLASSIFY_1602(1602,"类目编码不能包含特殊字符"),
	CLASSIFY_1603(1603,"类目名称为空"),
	CLASSIFY_1604(1604,"类目名称不能包含特殊字符"),
	CLASSIFY_1605(1605,"未上传类目图片"),
	CLASSIFY_1606(1605,"上传类目图片失败"),
	
	//1700-1799 委售模块
	BUSSINESS_1700(1700,"该委托单未处于上报状态,不允许上报."),
	BUSSINESS_1701(1701,"状态已更新."),
	BUSSINESS_1702(1702,"委托单未处于交易中"),
	BUSSINESS_1703(1703,"委托单不存在"),
	BUSSINESS_1704(1704,"审核状态不正确"),
	BUSSINESS_1705(1705,"审核失败，退货申请未处于待审核状态"),
	BUSSINESS_1706(1706,"挂售单已申请退货，不允许重复申请"),


	//1800-1899 评论
	BUSINESS_1801(1801, "评论{0}敏感词受限"),
	//1900-1999 交割
	BUSINESS_1901(1901, "提货单不存在"),
	BUSINESS_1902(1902, "提货单状态非法"),
	BUSINESS_1903(1903, "提货地址不存在"),

	//2000 - 2099房间相关
	BUSINESS_2000(2000, "房间不存在"),
	//2200 - 2299 优惠券相关
    BUSINESS_2200(2200, "无可用优惠券"),
    BUSINESS_2201(2201, "优惠券不可用"),
    BUSINESS_2202(2202, "优惠券批次不存在"),
    BUSINESS_2203(2203, "优惠券已发放，不允许删除"),
    BUSINESS_2204(2204, "优惠券已过期"),
    BUSINESS_2205(2205, "优惠券不存在"),
    
    //2300 - 2399 平台房间相关
    BUSINESS_2300(2300, "平台房间不存在."),
    BUSINESS_2301(2301, "房间访问码校验失败,请重新输入"),
    BUSINESS_2302(2302, "房间访问权限受限"),
	BUSINESS_2303(2303, "您在{0}分钟内累计输错密码达到{1}次,禁止访问时长{2}分钟"),
	BUSINESS_2304(2304, "该分类下存在二级分类,不允许删除"),
	BUSINESS_2305(2305, "该分类下存在房间，不允许删除"),


	//2600 - 2699 商品托管/回拍相关
    BUSINESS_2600(2600,"托管单不存在"),
    BUSINESS_2601(2601,"托管人与申请人不一致"),
    BUSINESS_2602(2602,"托管单状态未处于托管中，不允许操作"),
    BUSINESS_2651(2651,"商品在回拍中"),
    BUSINESS_2652(2652,"回拍记录不存在"),
    BUSINESS_2653(2653,"回拍已审核，请不要重复操作"),
    BUSINESS_2654(2654,"回拍记录状态异常"),
	BUSINESS_2655(2655,"可申请回拍的时间未到达"),
	BUSINESS_2656(2656,"该商品不允许回拍"),
	BUSINESS_2657(2657,"该托管单存在未缴清的托管费"),

	//2400 - 2499 禁言管理相关
	BUSINESS_2400(2400, "该用户不处于禁言中状态"),
	BUSINESS_2401(2401, "该用户已处于禁言中状态"),
	BUSINESS_2402(2402, "您处于禁言状态，不允许发言"),

	//2500 - 2599 商品池相关
	BUSINESS_2500(2500, "商品库存不足"),
	BUSINESS_2501(2501, "已存在商品池处理任务"),

	//3000-3200 统一资金相关业务码定义
	BUSSNESS_3001(3001,"入金进一步安全校验"),
	BUSSNESS_3002(3002,"提现失败"),
	BUSSNESS_3003(3003,"资金操作失败"),
	BUSSNESS_3010(3010,"绑卡信息校验失败,请修改绑卡信息"),
	BUSSNESS_3015(3015,"需进一步绑卡校验(短信校验),短信已发送"),
	BUSSNESS_3016(3016,"通过重定向URL，跳转三方平台进一步操作"),
	/**获取渠道信息失败*/
	BUSINESS_3017(3017, "获取渠道信息失败"),
	/**获取渠道信息失败**/
	BUSINESS_3018(3018, "渠道签约状态获取失败"),
	/**等级数据处理失败**/
	BUSINESS_3019(3019, "VIP等级数据处理失败"),
	/**线下银行银行卡备注信息必填**/
	BUSINESS_3020(3020, "银行卡备注信息必填"),

	//3200-3300 免登录相关
	BUSINESS_3201(3201, "账号或密码解密失败"),
	BUSINESS_3202(3202, "账号或密码获取失败"),
	BUSINESS_3203(3203, "账号或密码加密失败"),
	BUSINESS_3204(3204, "账号加密信息获取失败"),

	BUSINESS_3205(3205, "用户会话token不合法"),
	BUSINESS_3206(3206, "会话token已过期"),
	//3220-3230 退出
	BUSINESS_3221(3221, "用户退出失败"),

	//3231 - 3250 配额模块
	BUSINESS_3231(3231, "配额持仓账户不存在"),
	BUSINESS_3232(3232, "配额持仓账户可用配额不足"),
	BUSINESS_3233(3233, "配额类型不存在"),
	BUSINESS_3234(3234, "配额持仓账户可解冻数量不足"),
	BUSINESS_3235(3235, "配额兑换记录不存在"),
	BUSINESS_3236(3236, "配额兑换记录中的剩余数量不足"),
	BUSINESS_3237(3237, "配额兑换记录用户与查询用户不一致"),
	BUSINESS_3238(3238, "每次解冻量不能超过每次兑换量"),

	;
	/** 业务错误码 */
	private int errorNo;
	/** 业务错误说明 */
	private String errorInfo;

	private EnumBusinessCode(int errorNo, String errorInfo) {
		this.errorNo = errorNo;
		this.errorInfo = errorInfo;
	}

	/**
	 * 全局索引池
	 */
	private static Map<String, EnumBusinessCode> pool = new HashMap<String, EnumBusinessCode>();
	static {
		for (EnumBusinessCode et : EnumBusinessCode.values()) {
			pool.put(et.errorNo + "", et);
		}
	}

	/**
	 * 根据内容索引
	 * 
	 * @param errorNo
	 * @return
	 */
	public static EnumBusinessCode indexByValue(String errorNo) {
		return pool.get(errorNo);
	}

	public int getErrorNo() {
		return errorNo;
	}

	public void setErrorNo(int errorNo) {
		this.errorNo = errorNo;
	}

	public String getErrorInfo() {
		return errorInfo;
	}

	public void setErrorInfo(String errorInfo) {
		this.errorInfo = errorInfo;
	}

}
